1. Field of the Invention
The present invention relates to a method of and an apparatus for processing an image to express the shadow of an object which is created by the radiation of light from a light source, cast on another object disposed therebehind, based on the layout of a plurality of objects generated by three-dimensional modeling, a recording medium which stores a program for performing such image processing, and a program for performing such image processing.
2. Description of the Related Art
Recently, various computer graphics (CG) processing techniques including hidden line processing, hidden surface removal, smooth shading, texture mapping, etc. have been making rapid progress in combination with growing hardware advances.
According to one general CG processing procedure, a plurality of three-dimensional figures (objects) are generated according to three-dimensional modeling of CAD, and colors and shades are applied to the generated objects. Then, optical characteristics including mirroring, diffuse reflection, refraction, transparency, etc. are added to the objects, and surface patterns are applied to the objects. Furthermore, surrounding situations are rendered, e.g., windows and scenes are reflected and light rays are introduced.
Shading is governed by the directions of lines normal to polygons that make up an object and the viewpoint for light rays. There is a process of expressing the shadow of an object cast on another object positioned therebehind based on the layout of a light source and a plurality of objects. The latter process, rather than the shading, cannot be performed by techniques other than a highly costly rendering approach such as ray tracing.
If no high cost should be incurred such as for real-time rendering, then it has heretofore been customary to approximate such a shadow with perspective projection onto a simple plane or the rendering of a simple figure such as a circle.
In addition, if the light source has a certain size such as a flame, it is extremely difficult to express shadows produced by the light source.
It is therefore an object of the present invention to provide a method of and an apparatus for processing an image to express shadows with respect to a plurality of objects arranged in a complex layout or a shadow with respect to an object having a complex shape, a recording medium which stores a program capable of simply expressing such a shadow or shadows, and a program for expressing such a shadow or shadows.
Another object of the present invention is to provide a method of and an apparatus for processing an image so as to be able to selectively express a shadow with respect to an object, a recording medium which stores a program capable of selectively expressing a shadow with respect to an object, and a program for selectively expressing a shadow with respect to an object.
Still another object of the present invention is to provide a method of and an apparatus for processing an image so as to be able to easily apply various effects such as blurring in expressing a shadow with respect to an object, a recording medium which stores a program capable of easily applying various effects in expressing a shadow with respect to an object, and a program for easily applying various effects in expressing a shadow with respect to an object.
Yet another object of the present invention is to provide a method of and an apparatus for processing an image so as to be able to easily control shadow blurring among various effects on shadows for easily expressing a more realistic shadow, a recording medium which stores a program capable of easily expressing a more realistic shadow, and a program for easily expressing a more realistic shadow.
Yet still another object of the present invention is to provide a method of and an apparatus for processing an image so as to be able to easily express a projected image of an extended light source such as a flame and a shadow produced by such an extended light source, a recording medium which stores a program capable of easily expressing a projected image of an extended light source such as a flame and a shadow produced by such an extended light source, and a program for easily expressing a projected image of an extended light source such as a flame and a shadow produced by such an extended light source.
A method of processing an image according to the present invention comprises the steps of establishing at least one virtual plane from the layout of a plurality of objects to generated by three-dimensional modeling, and expressing a shadow of the object projected onto the virtual plane by a light source as a viewpoint, on the object that is farther from the light source than the object.
With the above method, it is possible to express easily a shadow on a plurality of objects arranged in a complex layout or a shadow with respect to an object having a complex shape.
The method may further comprise the steps of defining a shadow expression attribute as to whether the shadow is to be expressed on the objects in light source processing attributes of the objects, and selectively expressing the shadow on the object based on the shadow expression attribute. In this manner, the shadow may selectively be expressed with respect to the object.
Specifically, the method may further comprise the steps of establishing a shadow plane which serves as a texture plane corresponding to the virtual plane, rendering the shadow of the object formed by projection onto the virtual plane on the shadow plane, and mapping the shadow rendered on the shadow plane onto the other object by way of texture mapping.
The step of mapping the shadow onto the other object by way of texture mapping may comprise the step of mapping the shadow onto the other object by way of texture mapping based on projected coordinates of the other object onto the virtual plane, or with respect to each of polygons of the other object.
The method may further comprise the steps of determining coordinates of the objects with the light source as a viewpoint, determining projected coordinates of the objects onto the virtual plane successively in a direction away from the light source, and rendering the shadow formed by the object on the shadow plane based on the projected coordinates each time texture mapping onto one of the objects is finished.
The method may further comprise the steps of determining the coordinates of the objects and the projected coordinates of the objects onto the virtual plane with respect to each of polygons of the objects, registering the determined coordinates in a rendering list successively in the direction away from the light source, and successively reading the registered coordinates from the rendering list for rendering the shadow on the shadow plane.
It is preferable to effect low-pass filtering on the shadow rendered on the shadow plane depending on at least the distance from the light source for thereby applying a blur to the shadow depending on at least the distance from the light source. In this manner, various effects, such as blurring, etc., can easily be applied to a shadow expressed with respect to an object.
The method may further comprise the steps of interpolating the shadow rendered on the generating shadow plane when it is expressed on the object, according to rendering depending on the shadow before it is subject to low-pass filtering, the shadow after it is subject to low-pass filtering, and the light source coordinates of the object to be processed, for thereby controlling the blur of the shadow. Thus, blurring can easily be controlled for easily expressing a more realistic shadow.
The method may further comprise the steps of preparing a reference shadow plane and a generating shadow plane as the shadow plane, and, each time the objects to be processed switch from one to another, copying the shadow rendered on the generating shadow plane onto the reference shadow plane, and, each time the shadow on the reference shadow plane is mapped by way of texture mapping with respect to each of polygons of one object, rendering a projected image of the polygon onto the virtual plane as a new combined shadow on the generating shadow plane.
Each time the shadow rendered on the generating shadow plane is copied onto the reference shadow plane, low-pass filtering may be effected on the shadow rendered on the generating shadow plane. In this manner, various effects, such as blurring, etc., can easily be applied to a shadow expressed with respect to an object.
The method may further comprise the steps of preparing, in addition to the reference shadow plane and the generating shadow plane as the shadow plane, a background shadow plane which is a texture plane corresponding to a background virtual plane disposed behind the object to be processed, with the light source as a viewpoint, rendering a shadow formed by projecting a shadow projected onto the virtual plane onto the background virtual plane, on the background shadow plane, and mapping a shadow expressed on the object to be processed by way of texture mapping, while interpolating the shadow according to rendering based on the shadow rendered on the reference shadow plane, the shadow rendered on the background shadow plane, and light source coordinates of the object. Thus, blurring can easily be controlled for easily expressing a more realistic shadow.
The method may further comprise the steps of establishing an extended light source as an initial value for the shadow plane, and reflecting the extended light source and forming a shadow thereof on the object.
An apparatus for processing an image according to the present invention comprises a first unit operable to establish at least one virtual plane from the layout of a plurality of objects generated by three-dimensional modeling, and second unit operable to express and a shadow of the object projected onto the virtual plane by a light source as a viewpoint, on the object that is farther from the light source than the object.
The first unit may define a shadow expression attribute as to whether the shadow is to be expressed on the objects in light source processing attributes of the objects, and wherein the second means may comprising expressing selectively express the shadow on the object based on the shadow expression attribute.
The second unit may have a rendering unit operable to establish a shadow plane which serves as a texture plane corresponding to the virtual plane, rendering the shadow of the object formed by projection onto the virtual plane on the shadow plane, and mapping the shadow rendered on the shadow plane onto the other object by way of texture mapping.
The rendering unit may comprise mapping mapping the shadow onto the other object by way of texture mapping based on projected coordinates of the other object onto the virtual plane, or with respect to each of polygons of the other object.
The second unit may comprise a coordinate calculating means for determining coordinates of the objects with the light source as a viewpoint, and determine projected coordinates of the objects onto the virtual plane successively in a direction away from the light source, and the rendering unit may be further operable to render the shadow formed by the object on the shadow plane based on the projected coordinates each time texture mapping onto one of the objects is finished.
The second unit may comprise a rendering list generating unit operable to determine the coordinates of the objects and the projected coordinates of the objects onto the virtual plane with respect to each of polygons of the objects, and registering the determined coordinates in a rendering list successively in the direction away from the light source, and the rendering unit may be further operable to successively read the registered coordinates from the rendering list for rendering the shadow on the shadow plane.
The rendering unit may be further operable to low-pass filter the shadow rendered on the shadow plane depending on at least the distance from the light source for thereby applying a blur to the shadow depending on at least the distance from the light source. The rendering unit may be further operable to interpolate the shadow rendered on the generating shadow plane when it is expressed on the object, according to rendering depending on the shadow before it is subject to low-pass filtering, the shadow after it is subject to low-pass filtering, and the light source coordinates of the object to be processed, for thereby controlling the blur of the shadow.
The rendering unit may be further operable to prepare a reference shadow plane and a generating shadow plane as the shadow plane, and, each time the objects to be processed switch from one to another, copying the shadow rendered on the generating shadow plane onto the reference shadow plane, and, each time the shadow on the reference shadow plane is mapped by way of texture mapping with respect to each of polygons of one object, rendering a projected image of the polygon onto the virtual plane as a new combined shadow on the generating shadow plane.
The rendering unit may be further operable to each time the shadow rendered on the generating shadow plane is copied onto the reference shadow plane effect low-pass filtering on the shadow rendered on the generating shadow plane.
The rendering unit may be further operable to prepare in addition to the reference shadow plane and the generating shadow plane as the shadow plane, a background shadow plane which is a texture plane corresponding to a background virtual plane disposed behind the object to be processed, with the light source as a viewpoint, render a shadow formed by projecting a shadow projected onto the virtual plane onto the background virtual plane, on the background shadow plane, and map a shadow expressed on the object to be processed by way of texture mapping, while interpolating the shadow according to rendering based on the shadow rendered on the reference shadow plane, the shadow rendered on the background shadow plane, and light source coordinates of the object.
The rendering unit may be further operable to establish an extended light source as an initial value for the shadow plane, and reflect the extended light source and forming a shadow thereof on the object.
A recording medium according to the present invention stores a program comprising the steps of (a) establishing at least one virtual plane from the layout of a plurality of objects generated by three-dimensional modeling, and (b) expressing a shadow of the object projected onto the virtual plane by a light source as a viewpoint, on the object that is farther from the light source than the object.
The recording medium with the stored program makes it possible to express easily a shadow on a plurality of objects arranged in a complex layout or a shadow with respect to an object having a complex shape.
The step (a) may comprises the step of defining a shadow expression attribute as to whether the shadow is to be expressed on the objects in light source processing attributes of the objects, and the step (b) may comprise the step of selectively expressing the shadow on the object based on the shadow expression attribute.
The step (b) may comprises the steps of (c) establishing a shadow plane which serves as a texture plane corresponding to the virtual plane, rendering the shadow of the object formed by projection onto the virtual plane on the shadow plane, and mapping the shadow rendered on the shadow plane onto the other object by way of texture mapping.
The steps (c) may further comprise the step of mapping the shadow onto the other object by way of texture mapping based on projected coordinates of the other object onto the virtual plane, or with respect to each of polygons of the other object.
The step (b) may further comprise the steps of determining coordinates of the objects with the light source as a viewpoint, and determining projected coordinates of the objects onto the virtual plane successively in a direction away from the light source, and the steps (c) may further comprise the step of rendering the shadow formed by the object on the shadow plane based on the projected coordinates each time texture mapping onto one of the objects is finished.
The step (b) may further comprise the steps of determining the coordinates of the objects and the projected coordinates of the objects onto the virtual plane with respect to each of polygons of the objects, and registering the determined coordinates in a rendering list successively in the direction away from the light source, and the steps (c) may further comprise the step of successively reading the registered coordinates from the rendering list for rendering the shadow on the shadow plane.
The steps (c) may further comprise the step of effecting low-pass filtering on the shadow rendered on the shadow plane depending on at least the distance from the light source for thereby applying a blur to the shadow depending on at least the distance from the light source.
The steps (c) may further comprise the step of interpolating the shadow rendered on the generating shadow plane when it is expressed on the object, according to rendering depending on the shadow before it is subject to low-pass filtering, the shadow after it is subject to low-pass filtering, and the light source coordinates of the object to be processed, for thereby controlling the blur of the shadow.
The steps (c) may further comprise the steps of preparing a reference shadow plane and a generating shadow plane as the shadow plane, and, each time the objects to be processed switch from one to another, copying the shadow rendered on the generating shadow plane onto the reference shadow plane, and, each time the shadow on the reference shadow plane is mapped by way of texture mapping with respect to each of polygons of one object, rendering a projected image of the polygon onto the virtual plane as a new combined shadow on the generating shadow plane.
The steps (c) may further comprise the step of, each time the shadow rendered on the generating shadow plane is copied onto the reference shadow plane, effecting low-pass filtering on the shadow rendered on the generating shadow plane.
The steps (c) may further comprise the steps of preparing, in addition to the reference shadow plane and the generating shadow plane as the shadow plane, a background shadow plane which is a texture plane corresponding to a background virtual plane disposed behind the object to be processed, with the light source as a viewpoint, rendering a shadow formed by projecting a shadow projected onto the virtual plane onto the background virtual plane, on the background shadow plane, and mapping a shadow expressed on the object to be processed by way of texture mapping, while interpolating the shadow according to rendering based on the shadow rendered on the reference shadow plane, the shadow rendered on the background shadow plane, and light source coordinates of the object.
The steps (c) may further comprise the steps of establishing an extended light source as an initial value for the shadow plane, and reflecting the extended light source and forming a shadow thereof on the object.
A program according to the present invention comprises the steps of (a) establishing at least one virtual plane from the layout of a plurality of objects generated by three-dimensional modeling, and (b) expressing a shadow of the object projected onto the virtual plane by a light source as a viewpoint, on the object that is farther from the light source than the object.
When the above program is executed, it is possible to express easily a shadow on a plurality of objects arranged in a complex layout or a shadow with respect to an object having a complex shape.